package learn.netty.nio;

import org.apache.ibatis.annotations.SelectKey;

import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.util.Set;

/**
 * @USER white
 * @DATETIME 2020/12/6 9:28
 */
public class NioServer {

    public void start() throws IOException {
        ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
        Selector selector = Selector.open();
        serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
        int select = selector.select();
        Set<SelectionKey> selectionKeys = selector.selectedKeys();
        selectionKeys.forEach(selectionKey -> {
            if (selectionKey.interestOps() == SelectionKey.OP_ACCEPT){

            }
        });
    }

}
